'use strict';

var path = require('path');
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var conf = require('./conf');
var del = require('del');

var browserSync = require('browser-sync');

var $ = require('gulp-load-plugins')();

gulp.task('webpack', function () {
  return gulp.src(path.join(conf.paths.src, 'app/main.js'))
    .pipe(webpack(require('../webpack.config.js')))
    .pipe(gulp.dest(path.join(conf.paths.src, 'dist/')))
});

gulp.task('scripts-reload', function() {
  return buildScripts()
    .pipe(browserSync.stream());
});

gulp.task('scripts', function() {
  return buildScripts();
});

function buildScripts() {
  //YueDong 暂时不校验代码格式
  return gulp.src(path.join(conf.paths.src, '/app/**/*.js'))
  //   .pipe($.eslint())
  //   .pipe($.eslint.format())
  //   .pipe($.size())
  // return;
};
